package itdep.domain.student;

import itdep.domain.NamedEntity;
import itdep.domain.division.Specialization;
import itdep.domain.education.EducationYear;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Ivan Khalopik
 * @version $Revision: 10 $ $Date: 2010-06-16 07:13:04 +0000 (Wed, 16 Jun 2010) $
 */
@Entity
@Table(name = "STUDENT_GROUP")
public class StudentGroup extends NamedEntity {

	@ManyToOne
	@JoinColumn(name = "ID_SPECIALIZATION", nullable = false)
	private Specialization specialization;

	@ManyToOne
	@JoinColumn(name = "ID_ENTRY_YEAR", nullable = false)
	private EducationYear educationYear;

	@OneToMany(mappedBy = "studentGroup")
	private Set<Student> students = new HashSet<Student>();

	public Specialization getSpecialization() {
		return specialization;
	}

	public void setSpecialization(Specialization specialization) {
		this.specialization = specialization;
	}

	public EducationYear getEducationYear() {
		return educationYear;
	}

	public void setEducationYear(EducationYear educationYear) {
		this.educationYear = educationYear;
	}

	public Set<Student> getStudents() {
		return students;
	}

	public void setStudents(Set<Student> students) {
		this.students = students;
	}
}